<template>
  <el-breadcrumb class="app-breadcrumb" separator="/">
    <!-- <transition-group name="breadcrumb"> -->
      <el-breadcrumb-item v-for="(item,index)  in levelList" :key="index">
        <!-- <template v-if="item.name !== 'home'"> -->
          <span v-if="index === levelList.length-1" class="no-redirect">{{item.name}}</span>
          <a v-else>{{item.name}}</a>
        <!-- </template> -->
      </el-breadcrumb-item>
    <!-- </transition-group> -->
  </el-breadcrumb>
</template>

<script>
export default {
  created () {
    this.getBreadcrumb()
  },
  data () {
    return {
      levelList: null
    }
  },
  watch: {
    $route () {
      this.getBreadcrumb()
    }
  },
  methods: {
    getBreadcrumb () {
      let matched = this.$route.matched.filter(item => item.name)
      this.levelList = matched
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .app-breadcrumb.el-breadcrumb {
    font-size: 16px;
    line-height: 28px;
    padding-left: 10px;
    padding-bottom: 5px;
    margin-bottom: 15px;
    border-bottom: 2px solid #eeeeee;
    .no-redirect {
      color: #97a8be;
      cursor: text;
    }
    .el-breadcrumb__inner, .el-breadcrumb__inner a {
      font-weight: 400
    }
  }
</style>
